﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Webhost.Default" %>

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Workflow Application</title>
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <style type="text/css">
        body
        {
            margin: 0;
            height: 100%;
            width: 100%;
            min-height:400px;
            min-width:400px;
        }
        .silverlightHost
        {
            display: block;
            position: fixed;
            left: 0;
            top: 0;
            height: 100%;
            width: 100%;
            min-height:400px;
            min-width:400px;
        }
    </style>
    
     <script type="text/javascript">
        function clearAuthenticationCache() {
            // Default to a non-existing page (give error 500).
            // An empty page is better, here.

            try {
                var agt = navigator.userAgent.toLowerCase();
                if (agt.indexOf("msie") != -1) {
                    // IE clear HTTP Authentication
                    document.execCommand("ClearAuthenticationCache");
                }
                else {
                    // Let's create an xmlhttp object
                    var xmlhttp = createXMLObject();
                    // Let's prepare invalid credentials
                    xmlhttp.open("GET", page, true, "logout", "logout");
                    // Let's send the request to the server
                    xmlhttp.send("");
                    // Let's abort the request
                    xmlhttp.abort();
                }
            } catch (e) {
                // There was an error
                return;
            }
        }

        function createXMLObject() {
            try {
                if (window.XMLHttpRequest) {
                    xmlhttp = new XMLHttpRequest();
                }
                // code for IE
                else if (window.ActiveXObject) {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
            } catch (e) {
                xmlhttp = false
            }
            return xmlhttp;
        }

        window.onbeforeunload = confirmExit;
        var needToConfirm = false;
        function confirmExit() {
            if (needToConfirm) {
                return "Workflow is in execution. Do you want to close this webpage?";
            }
        }


    </script>
</head>
<body>
    <form id="form1" runat="server">
    
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Silverlight ID="agControl" class="silverlightHost" runat="server" Source="~/ClientBin/WebClient.xap">
        </asp:Silverlight>
        <input type="hidden" ID="tbxUserName" runat="server"  />
    <input type="hidden"  ID="tbxDisplayName" runat="server" />
    
    </form>
</body>
</html>
